package com.leetcode.algorithm.y22.m06;

/**
 * 709. 转换成小写字母
 * 
 * https://leetcode.cn/problems/to-lower-case/
 * 
 * @author jie.deng
 *
 */
public class Question0709Solution01 {

	public String toLowerCase(String s) {
		if (s == null) {
			return null;
		}
		StringBuilder builder = new StringBuilder();

		for (int i = 0; i < s.length(); i++) {
			char ch = s.charAt(i);
			if (ch >= 'A' && ch <= 'Z') {
				builder.append((char) (ch - 'A' + 'a'));
			} else {
				builder.append(ch);
			}
		}

		return builder.toString();
	}

}
